package com.xuda.eduservice.controller.frant;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xuda.common.utils.R;
import com.xuda.eduservice.entity.EduCourse;
import com.xuda.eduservice.entity.EduTeacher;
import com.xuda.eduservice.service.EduCourseService;
import com.xuda.eduservice.service.EduTeacherService;
import com.xuda.eduservice.service.impl.EduTEacherAndCourse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：程序员徐大大
 * @description：TODO
 * @date ：2022-08-05 13:45
 */
@Api(description = "前台查询课程名师")
@RestController
@RequestMapping("/eduservice/indexfront")
//@CrossOrigin
public class IndexFrontController {

 @Autowired
 private EduTEacherAndCourse eduTEacherAndCourse;

    @ApiOperation(value = "查询前8条热门课程，查询前4条讲师")
    @GetMapping("index")
    public R index() {

        List<EduCourse> courseList = eduTEacherAndCourse.courseList();
        List<EduTeacher> teacherList = eduTEacherAndCourse.teacherList();


        return R.ok().data("courseList",courseList).data("teacherList",teacherList);
    }



}
